//
//  MyBalanceHeaderView.swift
//  XiaoJingMallSwift
//
//  Created by beisheng03 on 2017/9/6.
//  Copyright © 2017年 beisheng. All rights reserved.
//

import UIKit

class MyBalanceHeaderView: BaseTableHeaderFooterView {
    
    
    
    @IBOutlet weak var leftLabel: UILabel!
    
    @IBOutlet weak var leftBtn: UIButton!

    @IBOutlet weak var middleBtn: UIButton!
    
    @IBOutlet weak var rightBtn: UIButton!
    
    @IBOutlet weak var leftLineView: UIView!
    
    @IBOutlet weak var rightLineView: UIView!
    
    override func awakeFromNib() {
        super.awakeFromNib()
        leftBtn.setTitleColor(UIColor.colorWith(r: 0, g: 188, b: 137), for: .selected)
        middleBtn.setTitleColor(UIColor.colorWith(r: 0, g: 188, b: 137), for: .selected)
        rightBtn.setTitleColor(UIColor.colorWith(r: 0, g: 188, b: 137), for: .selected)
        leftLineView.backgroundColor = UIColor.dakGray()
        rightLineView.backgroundColor = UIColor.dakGray()
        leftBtn.setTitleColor(UIColor.dakGray(), for: .normal)
        middleBtn.setTitleColor(UIColor.dakGray(), for: .normal)
        rightBtn.setTitleColor(UIColor.dakGray(), for: .normal)
        contentView.backgroundColor = UIColor.viewBgGrey()
        
        
        
    }
    
    @IBAction func leftBtnDitTap(_ sender: UIButton) {
        if sender.isSelected == true{
            return
        }
        
        sender.isSelected = true
        
        middleBtn.isSelected = false
        rightBtn.isSelected = false
        
        let temp = viewController() as! MyBalanceController
        temp.type = "0"
        temp.loadData()
        
    }
    
    @IBAction func middleBtnDitTap(_ sender: UIButton) {
        if sender.isSelected == true{
            return
        }
        
        sender.isSelected = true
        
        leftBtn.isSelected = false
        rightBtn.isSelected = false
        let temp = viewController() as! MyBalanceController
        temp.type = "1"
        temp.loadData()
        
    }
    
    
    @IBAction func rightBtnDitTap(_ sender: UIButton) {
        
        if sender.isSelected == true{
            return
        }
        
        sender.isSelected = true
        
        leftBtn.isSelected = false
        middleBtn.isSelected = false

        let temp = viewController() as! MyBalanceController
        temp.type = "2"
        temp.loadData()
    }
    
    
}
